/**
 * @file:          Config_StepperMotor.c
 * @brief:
 * @details:
 * @author:        wjh
 * @date created:  2023.06.12
 * @version:       1.0.0
 * @par copyright (c):
 *
 * @par history (desc):
 *   version:1.0.0, wjh, 2023.06.12,12:43:05
 */
/* Include Files **************************************************************/
#include "ConfigOption.h"
#include "string.h"
#include "main.h"

/* Macro Definition ***********************************************************/
/* Flash param version */
#define LOGGER_VERSION_MAJOR ((uint8_t)1)
#define LOGGER_VERSION_MINOR ((uint8_t)0)
#define LOGGER_RELEASE_DATE ("2024-03-12 10:26:54")

/* Function Declare ***********************************************************/

/* Global Variable Define *****************************************************/
void Config_Logger_v1_0(Logger *self);
Logger logger_v1_0 = {.ConfigParam = Config_Logger_v1_0};
void Config_Logger_v1_0(Logger *self)
{
    volatile StepperMotorController *smc = &stepper_motor_controller;

    memset(self, 0, sizeof(Logger));
    self->ConfigParam = Config_Logger_v1_0;
    self->Init = Logger_Init;
    self->RegisterVariableToTable = Logger_RegisterVariableToTable;

    self->param_en = 1;
    self->param_version.number.all = (((uint16_t)LOGGER_VERSION_MAJOR << 8) | ((uint16_t)LOGGER_VERSION_MINOR));
    self->param_version.release_date = LOGGER_RELEASE_DATE;
    self->param_continuous_send = 1;
    self->param_data_head = 0xff;
    self->param_sample_interval_n = 100;
    self->param_n_pack_to_send = 10;

    uint8_t n = 0;
    // self->RegisterVariableToTable(self, n++, &(smc->isr_tick), sizeof(smc->isr_tick), "uint32_t", "isr_tick");
    // self->RegisterVariableToTable(self, n++, &(smc->in_pos_cmd), sizeof(smc->in_pos_cmd), "float", "pos_ref");
    // self->RegisterVariableToTable(self, n++, &(smc->pos_fdb_encoder), sizeof(smc->pos_fdb_encoder), "float", "pos_fdb");
    self->RegisterVariableToTable(self, n++, &(smc->controller->spd_fdb_ctrl), sizeof(smc->controller->spd_fdb_ctrl), "float", "spd_fdb");
    self->RegisterVariableToTable(self, n++, &(smc->controller->foc.iq), sizeof(smc->controller->foc.iq), "float", "iq_fdb");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->foc.ud), sizeof(smc->controller->foc.ud), "float", "ud");
    self->RegisterVariableToTable(self, n++, &(smc->controller->foc.uq), sizeof(smc->controller->foc.uq), "float", "uq");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->id_loop_pid.out), sizeof(smc->controller->id_loop_pid.out), "float", "id_pid_out");
    self->RegisterVariableToTable(self, n++, &(smc->controller->iq_loop_pid.out), sizeof(smc->controller->iq_loop_pid.out), "float", "iq_pid_out");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->ud_feedforward), sizeof(smc->controller->ud_feedforward), "float", "ud_feedforward");
    self->RegisterVariableToTable(self, n++, &(smc->controller->uq_feedforward), sizeof(smc->controller->uq_feedforward), "float", "uq_feedforward");
    // self->RegisterVariableToTable(self, n++, &(smc->step_controller.out_pulse_cmd), sizeof(smc->step_controller.out_pulse_cmd), "int32_t", "out_pulse_cmd");
    // self->RegisterVariableToTable(self, n++, &(smc->in_pos_cmd), sizeof(smc->in_pos_cmd), "float", "in_pos_cmd");
    // self->RegisterVariableToTable(self, n++, &(smc->in_spd_cmd), sizeof(smc->in_spd_cmd), "float", "in_spd_cmd");
    // self->RegisterVariableToTable(self, n++, &(smc->in_acc_cmd), sizeof(smc->in_acc_cmd), "float", "in_acc_cmd");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->iqfdf_before_u), sizeof(smc->controller->iqfdf_before_u), "float", "iqfdf_before_u");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->iq_feedforward), sizeof(smc->controller->iq_feedforward), "float", "iq_feedforward");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->leso.out_z3), sizeof(smc->controller->leso.out_z3), "float", "leso.out_z3");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->pos_loop_pid.out), sizeof(smc->controller->pos_loop_pid.out), "float", "pos_loop_pid.out");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->spd_loop_pid.out), sizeof(smc->controller->spd_loop_pid.out), "float", "spd_loop_pid.out");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->id_loop_pid.out), sizeof(smc->controller->id_loop_pid.out), "float", "id_loop_pid.out");
    // self->RegisterVariableToTable(self, n++, &(smc->controller->iq_loop_pid.out), sizeof(smc->controller->iq_loop_pid.out), "float", "iq_loop_pid.out");
}
